import requests from '@/utils/request';

export const login = (data: { [props: string]: any }) => {
  data.client_id = 'intern';
  data.client_secret = '123456';
  data.grant_type = 'password';
  data.scope = 'all';
  let formData = new FormData();
  for (let i in data) {
    formData.append(i, data[i]);
  }
  return requests('/auth/oauth/token', {
    method: 'post',
    query: formData
  });
};

export const getCaptcha = () => {
  return requests('/yst-system/sec/captcha', {
    method: 'get'
  });
};
export const getCurrent = () => {
  return requests('/yst-system/sys/users/current', {
    method: 'get'
  });
};
export const getAnswer = (data: any) => {
  return requests('/yst-b2c/sec/capkey/' + data, {
    method: 'get'
  });
};
export const getOrgInfo = () => {
  return requests('/yst-support/org/emp/user/current', { method: 'get' });
};
